#include "../RepositoriesListWidget.h"
#include "ui_RepositoriesListWidget.h"

#include "presenters/RepositoriesListPresenter.h"
#include "../../common/services/ServiceLocator.h"

// Constructor and destructor.

RepositoriesListWidget::RepositoriesListWidget(
	QWidget *parent, Qt::WindowFlags flags)
	: QWidget(parent, flags)
{
	createUi();
	presenter = new RepositoriesListPresenter(this);
}

RepositoriesListWidget::~RepositoriesListWidget()
{
	delete presenter;
	delete ui;
}

// Methods.

void RepositoriesListWidget::setServiceLocator(ServiceLocator *servicesFactory)
{
	presenter->setServiceLocator(servicesFactory);
}

void RepositoriesListWidget::loadRepositoriesList()
{
	presenter->loadRepositoriesList();
}

// Helpers.

void RepositoriesListWidget::createUi()
{
	ui = new Ui::RepositoriesListWidget();
	ui->setupUi(this);
}
